<?
//inculde即可以使用data数据。本页所有的data数据，倾在controller都处理好
include_once("../../../common/module/checkA.php");
include_once("../../../../config.php");
include_once("../controller/detail-edit.php");
?>





<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

    <? include_once(ROOT_PATH_ . "/controller/common/module/head.php"); ?>

    <link href="../asset/css/member.css"      rel="stylesheet" type="text/css"/>
<!--    <script charset="utf-8" src="../keditor/kindeditor-all.js"></script>-->
    <script src="/application/keditor/kindeditor-all.js"></script>

</head>


<body>

<div id="topbar">     <?php include ROOT_PATH_ . '/controller/common/module/topbar.php'; ?> </div>


<div id="container" class="<? echo $system_part ?>">

    <div id="maincontent">

        <div id="sidebar">
            <?php include ROOT_PATH_ . '/controller/common/module/sidebar.php'; ?>
        </div>


<div id="content" class="layui-form">
<h1> 人员资料 </h1>




    <div class="detail-box member-edit-box layui-form">

        <div class="detail-boxes">
            <ul class="detail-boxing">

                <div class="data">
                    <button type="button" class="layui-btn layui-btn-primary layui-btn-sm" onclick="call_send_mail()" >创建邮件</button>
<!--                    <button type="button" class="layui-btn layui-btn-primary layui-btn-sm">创建报价</button>-->
<!--                    <button type="button" class="layui-btn layui-btn-primary layui-btn-sm">创建订单</button>-->
                </div>

                <br/>




                    <div class="info">
                        <div class="sbox">
                            <div class="relation">
                                <text class="state"><? echo $data['member']['name']?></text>
                                <text>名称</text>
                            </div>
                        </div>

                        <div class="sbox">
                            <div class="relation">
                                <text class="state"><? echo $data['member']['gender']?></text>
                                <text>性别</text>
                            </div>
                        </div>


                        <div class="sbox">
                            <div class="relation">
                                <text class="state"><? echo $data['member']['position']?></text>
                                <text>职务</text>
                            </div>
                        </div>

                        <div class="sbox">
                            <div class="relation">
                                <text class="state">
                                    <a href="../../unit/view/detail-statistic.php?&nid=<?echo $data['member']['unitnid']?>&nowpageid=&now_extender=unit">
                                        <? echo $unit['name']?>
                                    </a> </text>
                                <text>所属</text>
                            </div>
                        </div>

                        <div class="sbox">
                            <div class="relation">
                                <text class="state"><? echo $data['member']['phone']?></text>
                                <text>电话</text>
                            </div>
                        </div>


                        <div class="sbox">
                            <div class="relation">
                                <text class="state"><? echo $data['member']['email']?></text>
                                <text>邮箱</text>
                            </div>
                        </div>

                        <div class="sbox">
                            <div class="relation">
                                <text class="state"><? echo $now_employee['name']?></text>
                                <text>当前业务员</text>
                            </div>
                        </div>


                        <div class="sbox">
                            <div class="relation">
                                <text class="state">
                                    <span style="color: <? if(count_days(date("Y-m-d"),$data['member']['checkpoint']) < 15 ) { echo "red";}?>">
                                    <?echo count_days(date("Y-m-d"),$data['member']['checkpoint'])?> 日
                                    </span>
                                     </text>
                                <text>下次联系 <?echo substr($data['member']['checkpoint'],0,10)?></text>
                            </div>
                        </div>



                    </div>



                <form id="edit-member-form" method="post"
                      action="detail-edit-function.php"
                      enctype="multipart/form-data" class="layui-form">


                    <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                        <ul class="layui-tab-title">
                            <li class="layui-this">详细资料</li>
<!--                            <li>报价记录</li>-->
<!--                            <li>订单记录</li>-->
                            <li>沟通记录</li>
                            <li>跟踪设置</li>
                        </ul>
                        <div class="layui-tab-content"  >



                            <div class="layui-tab-item layui-show">


                                <?php include "module/detail-edit-info.php"; ?>
                            </div>
<!--                            <div class="layui-tab-item">-->
<!--                                --><?php //include "module/mod-order-list.php"; ?>
<!--                            </div>-->
                            <div class="layui-tab-item contact">
                                <?php include "module/mod-contact-log.php"; ?>
                            </div>
                            <div class="layui-tab-item">
                                <?php include "module/mod-setting.php"; ?>
                            </div>


                        </div>
                    </div>


                    <input name="now_extender"       type="hidden"       value="<? echo $_REQUEST['now_extender'] ?>"/>
                    <input name="nid"       type="hidden"  value="<? echo $data['member']['nid']?>"
                    <input name="nowpageid" type="hidden"  value="<? echo $_REQUEST['nowpageid'] ?>"/>
                    <input name="sortby"    type="hidden"  value="<? echo $_REQUEST['sortby'] ?>"/>
                    <input name="unitnid"  type="hidden"  value="<? echo $data['member']['unitnid'] ?>"/>


                    <div class="function">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit   type="submit">立即提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>



                </form>






            </ul>
        </div>
    </div>





<!--content端點01-->
</div>
<!--maincontent端點01-->
<br class="clearfloat"/>
</div>
<!--container端點01-->
</div>


<?php include_once('../module/footer.php'); ?> </body>



<script>


    var editor;
    KindEditor.ready(function (K) {
        editor = K.create('textarea[name="member_log_content"]', {
            width : '90%',
            height : '300px',
            items : [
                'source', '|', 'undo', 'redo', '|', 'cut', 'copy', 'paste',
                'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
                'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
                'superscript', 'clearhtml', 'fullscreen',
                'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
                'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat','media','image', 'multiimage'
            ],
            allowFileManager: true,
            afterBlur: function () { editor.sync(); },
            allowFileManager: true,
            filterMode : false
        });

    });


    //激活发送邮件的层
    function call_send_mail(email,nid,agentnid)
    {
        var email = '<?echo $data['member']['email'];?>';
        var nid = '<? echo $data['member']['nid']; ?>';
        var agentnid = '<? echo $data['member']['agentnid']; ?>';
        var unitid = '<? echo $data['member']['unitnid']; ?>';
        layer.open({
            title:"邮件发送",
            type: 2,
            area: ['900px', '650px'],
            fixed: false, //不固定
            maxmin: true,
            content: 'module/mod-sendmail.php?email='+email+'&menberId='+nid+'&agentnId='+agentnid+'&unitnId='+unitid
        });
    }




    //生成简易的富文本编辑框
    layui.use('layedit', function(){
        var layedit = layui.layedit;
        var layeditTool = {tool: [
            'strong' //加粗
            ,'italic' //斜体
            ,'underline' //下划线
            ,'del' //删除线
            ,'|' //分割线
            ,'left' //左对齐
            ,'center' //居中对齐
            ,'right' //右对齐
            ,'|' //分割线
            ,'link' //超链接
            ,'unlink' //清除链接
            ,'face' //表情
        ]};

 //       layedit.build('member_log_content'); //建立编辑器
    });




</script>





<script>
layui.use('upload', function(){
    var $ = layui.jquery
        ,upload = layui.upload;

    //普通图片上传
    var uploadInst = upload.render({
        elem: '#test1'
        ,url: 'https://httpbin.org/post' //改成您自己的上传接口
        ,accept: 'file' //普通文件
        ,exts: 'jpg|jpeg|png|gif' //只允许上传压缩文件
        ,size: 60 //限制文件大小，单位 KB
        ,before: function(obj){
            //预读本地文件示例，不支持ie8
            obj.preview(function(index, file, result){
                $('#demo1').attr('src', result); //图片链接（base64）
            });
        }
        ,done: function(res){
            //如果上传失败
            if(res.code > 0){
                return layer.msg('上传失败');
            }
            //上传成功
        }
        ,error: function(){
            //演示失败状态，并实现重传
            var demoText = $('#demoText');
            demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
            demoText.find('.demo-reload').on('click', function(){
                uploadInst.upload();
            });
        }
    });




});
</script>


</html>
